Xceed DataGrid for Silverlight Documentation
LanguageToVisibilityConverter Class
Imports System.Windows.Data
Imports System.Collections.Generic
Imports Xceed.Silverlight.DataGrid
Imports System.Windows
 
 
 
Namespace Xceed.Silverlight.Documentation
  Public Class LanguageToVisibilityConverter 
                     Implements IValueConverter
 

    Public Function Convert( ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo ) As Object Implements IValueConverter.Convert
      Dim context As GroupContext  = CType( value, GroupContext )
 
      If ( Not context Is Nothing ) And ( Not context.GroupValue Is Nothing ) Then
        If( m_countries.Contains( context.GroupValue.ToString() ) ) Then
          Return Visibility.Visible
      End If
 
 
 
      Return Visibility.Collapsed
    End Function
 
 
 
    Public Function ConvertBack( object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture ) As Object Implements IValueConverter.ConvertBack
      Throw New NotSupportedException( "ConvertBack" )
    End Function
 
 
 
    Private m_countries As New List( Of String )( New String( 27 ) { "Belgium", "Benin", "Burkina-Faso", "Burundi", "Cameroon", "Canada", "Central African Republic", "Chad", "Comoros", "Congo", "Djibouti", "France", "Gabon", "Guinea", "Haiti", "Ivory Coast", "Luxembourg", "Madagascar", "Mali", "Monaco", "Niger", "Rwanda", "Senegal", "Seychelles", "Switzerland", "Togo", "Vanuatu" } )
  End Class
End Namespace

using System.Windows.Data;
using System.Collections.Generic;
using Xceed.Silverlight.DataGrid;
using System.Windows;
 
 
 
namespace Xceed.Silverlight.Documentation
{
  public class LanguageToVisibilityConverter : IValueConverter
  {
    public object Convert( object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture )
    {
      GroupContext context = value as GroupContext;
 
      if( context != null && context.GroupValue != null )
      {
        if( m_countries.Contains( context.GroupValue.ToString() ) )
          return Visibility.Visible;
      }
 
 
 
      return Visibility.Collapsed;
    }
 
 
 
    public object ConvertBack( object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture )
    {
      throw new NotSupportedException( "ConvertBack" );
    }
 
 
 
    private List<string> m_countries = new List<string>( new string[ 27 ] { "Belgium", "Benin", "Burkina-Faso", "Burundi", "Cameroon", "Canada", "Central African Republic", "Chad", "Comoros", "Congo", "Djibouti", "France", "Gabon", "Guinea", "Haiti", "Ivory Coast", "Luxembourg", "Madagascar", "Mali", "Monaco", "Niger", "Rwanda", "Senegal", "Seychelles", "Switzerland", "Togo", "Vanuatu" } );
  }
}

 

Send Feedback